@import '../theme/index.scss';

// 模块阴影
@mixin boxShadow {
  background: $--color-white;
  box-shadow: 0px 4px 24px 0px rgba(24, 28, 85, 0.24);
}

// 单行文本 超出隐藏
@mixin textEllipsis {
  overflow: hidden; //超出的文本隐藏
  text-overflow: ellipsis; //溢出用省略号显示
  white-space: nowrap;
}

// 多行文本超出隐藏
@mixin manyEllipsis ($row: 2) {
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: $row;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break:break-all;
}

// 清浮动
@mixin clearfix {
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

// 滚动条
@mixin scrollBar($w: 6px, $h: 6px, $bg: rgba(144,147,153,.3), $color: transparent) {
  box-sizing: border-box;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  &::-webkit-scrollbar {
    width: $w;
    height: $h;
  }
  &::-webkit-scrollbar-thumb {
    background-color: $bg;
    border-radius: 6px;
  }
  &::-webkit-scrollbar-track {
    background-color: $color;
    border-radius: 6px;
  }
}


// 相对定位
@mixin relative {
  position: relative;
  width: 100%;
  height: 100%;
}

// 相对定位且 剧中显示
@mixin pct($pct) {
  width: #{$pct};
  position: relative;
  margin: 0 auto;
}

// 三角形
@mixin triangle($width, $height, $color, $direction) {
  $width: $width/2;
  $color-border-style: $height solid $color;
  $transparent-border-style: $width solid transparent;
  height: 0;
  width: 0;

  @if $direction==up {
    border-bottom: $color-border-style;
    border-left: $transparent-border-style;
    border-right: $transparent-border-style;
  } @else if $direction==right {
    border-left: $color-border-style;
    border-top: $transparent-border-style;
    border-bottom: $transparent-border-style;
  } @else if $direction==down {
    border-top: $color-border-style;
    border-left: $transparent-border-style;
    border-right: $transparent-border-style;
  } @else if $direction==left {
    border-right: $color-border-style;
    border-top: $transparent-border-style;
    border-bottom: $transparent-border-style;
  }
}
